import fetch from '@/utils/fetch'

//获取video类型编码
export function fetchVideoCode(){
    return fetch({
        url:'/video/getVideoCode',
        method:'get'
    })
}

//获取网格
export function fetchNetGrid(){
    return fetch({
        url:'/video/getNetGrid',
        method:'get'
    })
}

// /video/getVideoInfo 获取所有video信息(分页 select All) 参数 String videoName, Integer netGridID, int page, int pageSize
export function fetchVideoInfo(query){
    return fetch({
        url:'/video/getVideoInfo',
        method:'post',
        params:{
            videoName:query.videoName,
            netGridID:query.netGridID,
            page:query.page,
            pageSize:query.pageSize
        }
    })
}

// /video/getDetailByID 查看详情 参数 id
export function fetchDetail(id){
    return fetch({
        url:'/video/getDetailByID',
        method:'get',
        params:{
            'id':id
        }
    })
}
// /video/getToUpdateVideoInfo 点击修改调用该接口获取所有信息（编码不是汉字）参数 id
export function fetchEditVideoInfo(id){
    return fetch({
        url:'/video/getToUpdateVideoInfo',
        method:'get',
        params:{
            id:id
        }
    })
}
// /video/addVideo 添加    参数 Video对象
export function addVideo(query){
    return fetch({
        url:'/video/addVideo',
        method:'post',
        data:query
    })
}
// /video/updateVideo 修改 参数 Video对象
export function updateVideo(query){
    return fetch({
        url:'/video/updateVideo',
        method:'post',
        data:query
    })
} 

// /video/deleteVideo 删除 参数 id
export function deleteVideo(id){
    return fetch({
        url:'/video/deleteVideo',
        method:'get',
        params:{
            id:id
        }
    })
}

//video/getNetGridForTree
export function getNetGridForTree(){
    return fetch({
        url:'/video/getNetGridForTree',
        method:'get'
    })
}

export function getVideoForTree(id){
    return fetch({
        url:'/video/getVideoForTree',
        params:{
            'id':id
        }
    })
}

let host = '122.97.218.162:18080'

export function getCamera(token,params){
    return fetch({
        url:`http://${host}/openapi/service/vss/preview/getPreviewParamByCameraUuid?token=${token}`,
        type:'post',
        data:params
    })
}